package cn.edu.bzu.ie.sf.mealsmisweb.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @version v1.0.0
 * @Package : cn.edu.bzu.ie.sf.mealsmisweb.config
 * @Description : TODO
 * @Create on : 2021/8/17 16:04
 * @author: Feng Song 宋锋
 **/
@Configuration
public class ApplicationConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /*
         * 说明：增加虚拟路径(经过本人测试：在此处配置的虚拟路径，用springboot内置的tomcat时有效，
         * 用外部的tomcat也有效;所以用到外部的tomcat时不需在tomcat/config下的相应文件配置虚拟路径了,阿里云linux也没问题)
         */
        //Windows下
        registry.addResourceHandler("/upload/**").addResourceLocations("file:D:/upload/");
        //Mac或Linux下(没有CDEF盘符)
        //registry.addResourceHandler("/upload/**").addResourceLocations("file:/Users/sf/Documents/uploads/");
        super.addResourceHandlers(registry);
    }
}